package com.summer.test.controller;

import java.util.Arrays;

import org.apache.commons.logging.Log;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.summer.core.annotations.Logger;
import com.summer.core.annotations.ScopeType;
import com.summer.core.controller.EntityQuery;
import com.summer.test.model.SystemFee;
import com.summer.test.model.SystemLoanFee;
import com.summer.test.model.SystemLoanType;


@Component
@Scope(ScopeType.VIEW)
public class LoanFeeList extends EntityQuery<SystemLoanFee> {
	
	@Logger
	private static Log log;
	
	private String COUNT_HQL = "select count(slf) from SystemLoanFee slf";
	private String HQL = "select distinct slf from SystemLoanFee slf";
	public LoanFeeList() {
		setCountHql(COUNT_HQL);
		setHql(HQL);
		final String[] RESTRICTIONS = {
				
				"slf.loanType.name=#{loanFeeList.example.loanType.name}",
				"slf.systemFee.name like #{loanFeeList.example.systemFee.name}",
				"slf.feeType like #{loanFeeList.example.feeType}",
				"slf.status like #{loanFeeList.example.status}"
				
				};
		setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
	}
	
	@Override
	protected void initExample() {
		SystemLoanFee example=new SystemLoanFee();
		SystemLoanType loanType=new SystemLoanType();
		SystemFee systemFee=new SystemFee();
		example.setLoanType(loanType);
		example.setSystemFee(systemFee);
		setExample(example);
	}

}
